﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Test.aspx.cs" Inherits="IDM.Sandbox.Test" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>Untitled Page</title>
    <script type="text/javascript">
    	function openTab1(url, title, args) {
    		var elements = parent.Ext.select('div[tabParent=true]').elements;    		

    		if (!elements.length) {
    			return;
    		}

    		if (args) {
    			if (typeof (args) == 'String') {
    				url = Ext.urlAppend(url, args);
    			} else {
    				url = Ext.urlAppend(url, Ext.urlEncode(args));
    			}
    		}

    		var tabPanel = null; 

    		if (Ext.isGecko || Ext.isChrome) {
    			tabPanel = parent.Ext.getCmp(elements[0].firstChild.nextSibling.id);
    		}
    		else {
    			tabPanel = parent.Ext.getCmp(elements[0].firstChild.id);
    		}
    		
    		parent.Ext.net.DirectMethods.OpenTab(tabPanel.id, url, title, tabPanel.items.length);
    	}
    </script>
</head>
<body>
	<ext:ResourceManager runat="server">
	</ext:ResourceManager>
	
    <form id="form1" runat="server">
    <ext:Viewport runat="server" Layout="Fit">
    <Content>
    
    <ext:Panel runat="server" Layout="Fit" Height="500">
    <Content>
		<ext:Button runat="server" ID="ParentTable" Text="Open in parent">
			<Listeners>
				<Click Handler="openTab1('Test.aspx', 'title', {ID: 10});" />
			</Listeners>
		</ext:Button>
    </Content>
    </ext:Panel>    
    
    </Content>
    </ext:Viewport>
    </form>
</body>
</html>
